<?php
namespace Common\Alipay;

header("Content-type: text/html; charset=utf-8");


require_once 'wap/wappay/service/AlipayTradeService.php';
require_once 'wap/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';

class Wappay{
	
	//手机支付
	public static function pay($out_trade_no,$subject,$total_amount,$body){
			   //商户订单号，商户网站订单系统中唯一订单号，必填
			    $out_trade_no = trim($out_trade_no);
			    //订单名称，必填
			    $subject = trim($subject);
			    //付款金额，必填
			    $total_amount = trim($total_amount);
			    //商品描述，可空
			    $body = trim($body);
			    //超时时间
			    $timeout_express="1m";
			
			    $payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
			    $payRequestBuilder->setBody($body);
			    $payRequestBuilder->setSubject($subject);
			    $payRequestBuilder->setOutTradeNo($out_trade_no);
			    $payRequestBuilder->setTotalAmount($total_amount);
			    $payRequestBuilder->setTimeExpress($timeout_express);
			
			    $payResponse = new \AlipayTradeService(C('config'));
			    $result=$payResponse->wapPay($payRequestBuilder,$config['return_url'],$config['notify_url']);
			    return ;
			
	}
}
?>